#ifndef LINE_H
#define LINE_H

#include <QLine>
#include "Dot.h"
#include "Element.h"

class QPainter;
class Cell;

class Line : public QLine, public Element
{
public:    
    Line(Dot *p1,Dot *p2,Game::Player owner);
    Game::Player owner();
    bool nearToMe(QPoint pos);
    bool hozizontal();
    Dot *dot1()const;
    Dot *dot2()const;
    void draw(QPainter *pDC);
    QLine line();
    bool isSame(Element *pElem, bool bByValue = true);
    bool isSame(QLine line);
    static bool isSame(QLine line1,QLine line2);
    bool isMyContainer(Cell *pCell);
    int containerCount();

private:
    bool addContainer(Cell *pCell);
    bool removeContainer(Cell *pCell);

private:
    Dot *mp1, *mp2;
    Game::Player mOwner;
    QList<Cell*> mContainerCells;

friend class Cell;
};

#endif // LINE_H
